package com.football.springboot.mapper;

import com.football.springboot.entity.Game;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.football.springboot.entity.GameData;
import com.football.springboot.entity.League;
import com.football.springboot.entity.Team;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 李越
 * @since 2023-02-22
 */
public interface GameMapper extends BaseMapper<Game> {

    //查找一场比赛的主场球队信息
    Team getHomeTeaminfo(int id);

    //查找一场比赛的客场球队信息
    Team getAwayTeaminfo(int id);

    //根据外键联赛id查找联赛信息
    League getLeagueinfo(int id);

    //根据主场球队hometeam找出主场球队比赛的信息(查询用)
    List<Integer> getGamebyhometeam(int hometeam);

    //根据客场球队awayteam找出客场球队比赛的信息(查询用)
    List<Integer> getGamebyawayteam(int awayteam);

    //添加一场比赛(未完成)
    Integer addgame(Game game);

    //查看比赛详细信息
    GameData getGameData(int gameId);

    //查看一场比赛的两个球队信息
    List<Team> getTeamByGameId(@Param("game_id") Integer gameId);
}
